package com.jash.qiushi;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.jash.qiushi.entities.TypeEntity;

import java.util.List;

public class TypeAdapter extends FragmentPagerAdapter {
    private List<TypeEntity> list;

    public TypeAdapter(FragmentManager fm, List<TypeEntity> list) {
        super(fm);
        this.list = list;
    }

    @Override
    public Fragment getItem(int position) {
        return RecyclerFragment.getInstance(list.get(position).getType());
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position).getTitle();
    }
}
